package cn.zjj.controller;

import cn.zjj.domain.Order;
import cn.zjj.domain.User;
import cn.zjj.feignClient.UserFeignClient;
import cn.zjj.service.IOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/order")
public class OrderController {
    @Autowired
    private UserFeignClient userFeignClient;
    @Autowired
    private IOrderService orderService;


    @GetMapping("/selectById/{id}")
    public User selectById(@PathVariable("id") Long id){
        Order order = new Order(1L,"dadsada",1);

        orderService.insert(order);
        return userFeignClient.selectById(id);
    }

    @GetMapping("/selectAll")
    public List<User> select(){
        return userFeignClient.select();
    }
}
